//
//  ViewController.swift
//  Test
//
//  Created by DengJinHui on 2017/2/22.
//  Copyright © 2017年 DengJinHui. All rights reserved.
//

import UIKit
import PureLayout

class ViewController: UINavigationController {
    
    var relodButton: UIButton = {
        let button = UIButton()
        button.setTitle("reloaData", for: .normal)
        button.backgroundColor = UIColor.gray
        return button
    }()
    var relodSectionButton: UIButton = {
        let button = UIButton()
        button.setTitle("relodSection", for: .normal)
        button.backgroundColor = UIColor.blue
        return button
    }()
    var relodRowButton: UIButton = {
        let button = UIButton()
        button.setTitle("relodRow", for: .normal)
        button.backgroundColor = UIColor.red
        return button
    }()
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.white
        setupView()
    }
    
    func setupView() {
        self.view.addSubview(relodButton)
        self.view.addSubview(relodSectionButton)
        self.view.addSubview(relodRowButton)
        relodButton.addTarget(self, action: #selector(ViewController.onClickRelodButton), for: .allTouchEvents)
        relodButton.autoPinEdge(toSuperviewEdge: .top,withInset: 100)
        relodButton.autoPinEdge(toSuperviewEdge: .left,withInset: 50)
        relodButton.autoPinEdge(toSuperviewEdge: .right,withInset: 50)
        relodButton.autoSetDimension(.height, toSize: 50)
        
        relodSectionButton.addTarget(self, action: #selector(ViewController.onClickRelodSectionButton), for: .allTouchEvents)
        relodSectionButton.autoPinEdge(.top, to: .bottom, of: relodButton,withOffset: 50)
        relodSectionButton.autoPinEdge(toSuperviewEdge: .left,withInset: 50)
        relodSectionButton.autoPinEdge(toSuperviewEdge: .right,withInset: 50)
        relodSectionButton.autoSetDimension(.height, toSize: 50)
        
        relodRowButton.addTarget(self, action: #selector(ViewController.onClickRelodRowButton), for: .allTouchEvents)
        relodRowButton.autoPinEdge(.top, to: .bottom, of: relodSectionButton,withOffset: 50)
        relodRowButton.autoPinEdge(toSuperviewEdge: .left,withInset: 50)
        relodRowButton.autoPinEdge(toSuperviewEdge: .right,withInset: 50)
        relodRowButton.autoSetDimension(.height, toSize: 50)
    }
    
    func onClickRelodButton() {
        let vc = relodTableVC()
        self.pushViewController(vc, animated: true)
    }
    func onClickRelodSectionButton() {
        
    }
    func onClickRelodRowButton() {
        
    }
    
}

